package com.lancoo.znbkxx.teacher.widget

import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.PopupWindow
import android.widget.RadioGroup
import com.google.android.material.chip.ChipGroup
import com.lancoo.znbkxx.teacher.R
import kotlinx.android.synthetic.main.view_filter_window.view.*

/**
 *@author Admin
 *@date 2021/2/3
 *
 */
class AIFilterPopupWindow(context: Context, onClickListener: View.OnClickListener,
    cgChangeListener: ChipGroup.OnCheckedChangeListener) : PopupWindow(context) {
    init {
        val contentView = LayoutInflater.from(context).inflate(R.layout.view_filter_window, null)
        contentView.apply {
            cg_finish.setOnCheckedChangeListener(cgChangeListener)
            cg_type.setOnCheckedChangeListener(cgChangeListener)
            tv_reset.setOnClickListener(onClickListener)
            tv_done.setOnClickListener(onClickListener)
        }
        this.contentView = contentView
        this.width = WindowManager.LayoutParams.MATCH_PARENT
        this.height = WindowManager.LayoutParams.WRAP_CONTENT
        this.isOutsideTouchable = false
        this.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
        this.isFocusable = true
        update()
    } 
}